package com.zkthink.ceres.product.dao;

import com.zkthink.base.mapper.SuperMapper;
import com.zkthink.ceres.product.entity.ProductSku;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * 商品的sku
 * </p>
 *
 * @author JustArgo
 * @date 2020-05-07
 */
@Repository
public interface ProductSkuMapper extends SuperMapper<ProductSku> {
    int delBySkuId(Long skuId);

    /** 根据商品id查询规格
     * @author JustArgo 2020/5/10 18:20
     * @return
     */
    List<ProductSku> selectByProductId(Long productId);

    /** 更新sku的库存
     * @author JustArgo 2020/5/12 9:09
     * @return
     */
    int updateSkuStock(@Param("skuId")Long skuId, @Param("addStock")Integer addStock);

    /** 查询sku的库存总和
     * @author JustArgo 2020/5/23 20:06
     * @return
     */
    Integer selectSumStock(Long productId);

    /** 查找要删除的skuId列表
     * @author JustArgo 2020/5/30 12:11
     * @return
     */
    List<Long> selectByProductIdAndSkuIdNotInList(@Param("productId")Long productId, @Param("skuIdList")List<Long> skuIdList);

    /** 逻辑删除批量sku
     * @author JustArgo 2020/5/30 16:33
     * @return
     */
    int deleteBySkuIdList(List<Long> shouldDeletedSkuIdList);
}
